<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>注册</title>
    <script src="{{ asset('/js/jquery.min.js') }}"></script>
</head>
<body>

账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号: <input type="text" placeholder="用户" id="username" ><br>
密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码: <input type="password" placeholder="密码" id="password"><br>
再次密码: <input type="password" placeholder="再次输入密码" id="password_confirmation"><br>
邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱: <input type="email" placeholder="邮箱" id="email"><br>
手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机: <input type="number" placeholder="手机" id="telephone"><br>


<button id="registerBtn">注册</button>

<script>
    $(function () {
        console.log('hello');

        $('#registerBtn').on('click', function () {
            var username = $("#username").val();
            var password = $('#password').val();
            var password_confirmation = $('#password_confirmation').val();
            var email = $('#email').val();
            var telephone = $('#telephone').val();

            console.log(username);
            console.log(password);
            console.log(password_confirmation);
            console.log(email);
            console.log(telephone);

            var data = {
                'username': username,
                'password': password,
                'password_confirmation': password_confirmation,
                'email': email,
                'telephone': telephone,
            };

            $.ajax({
                url: '/api/v1/member/register',
                type: 'POST', //GET
                data: data,
                dataType: 'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                success: function (data) {
                    console.log(data);
                },
                error: function (xhr, textStatus) {

                }
            });
        });





    });


</script>
</body>
</html>